local jianzun = fk.CreateSkill {
  name = "hanqing__jianzun",
  tags = { Skill.Lord },
}

Fk:loadTranslationTable{
  ["hanqing__jianzun"] = "僭尊",
  [":hanqing__jianzun"] = "主公技，其他角色使用点数为K的牌结算后，其可以将之交给你，若其为齐势力角色，你回复1点体力。",

  ["#hanqing__jianzun-invoke"] = "僭尊：你可以将%arg交给 %src",
  ["#hanqing__jianzun2-invoke"] = "僭尊：你可以将%arg交给 %src，其回复1点体力",
}

jianzun:addEffect(fk.CardUseFinished, {
  anim_type = "support",
  can_trigger = function(self, event, target, player, data)
    return target ~= player and player:hasSkill(jianzun.name) and
      data.card.number == 13 and not target.dead and
      table.contains({ Card.Processing, Card.DiscardPile, Card.PlayerEquip }, player.room:getCardArea(data.card))
  end,
  on_cost = function (self, event, target, player, data)
    local room = player.room
    local prompt = "#hanqing__jianzun-invoke:"..player.id.."::"..data.card:toLogString()
    if target.kingdom == "qi" then
      prompt = "#hanqing__jianzun2-invoke:"..player.id.."::"..data.card:toLogString()
    end
    return room:askToSkillInvoke(target, {
      skill_name = jianzun.name,
      prompt = prompt,
    })
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    room:obtainCard(player, data.card, true, fk.ReasonGive, target, jianzun.name)
    if target.kingdom == "qi" and not player.dead then
      room:recover{
        who = player,
        num = 1,
        recoverBy = player,
        skillName = jianzun.name,
      }
    end
  end,
})

return jianzun
